

	//模板获取区域
	var MainListTemplate=$("#MainList").html();
	$("#MainList").html("");
		//模板获取区域（往期）
	var OverlayList=$("#OverlayList").html();
	var DefOverlay=$("#OldView").html();
	$("#OldView").html("");

	//建立单项
	function BuildItem(Item,idx)
	{
		var Context=MainListTemplate;
		Context=Context.replace(/{Title}/g,Item.title);
		Context=Context.replace(/{Linker}/g,"http://www.bilibili.com/video/av"+Item.avid+"/");
		Context=Context.replace(/{Pts}/g,Item.pts);
		Context=Context.replace(/{Play}/g,Item.play);
		Context=Context.replace(/{Comment}/g,Item.comment);
		Context=Context.replace(/{Favourite}/g,Item.favourite);
		Context=Context.replace(/{Yb}/g,Item.yb);
		Context=Context.replace(/{PDate}/g,Item.publicdate);
		Context=Context.replace(/[^\"]+star\-image.png/g,Item.image);
		Context=Context.replace(/{PIndex}/g,idx);
		return Context;
	}
	function LoadMainList(LObject)
	{
		var Context="";
		var len=LObject.list.length;
		for(var i=0;i<len;i++)
		{
			var Ite=BuildItem(LObject.list[i],(i+1));
			Context=Context+Ite;
		}
		$("#MainList").html(Context);
		$("#MainList_Linker").attr("href","http://www.bilibili.com/video/av"+LObject.avid+"/");
	}
	LoadMainList(ListObject);

	//建立往期名单
	function BuildOverRelay(LObject)
	{
		var Context="";
		for(var i=1;i<=OverOldCount;i++)
		{
			var ID=LObject.id-i;
		    var Context2=OverlayList.replace(/{ID}/g,ID);
			Context=Context+Context2;
		}
		Context=Context+DefOverlay;
		$("#OverlayList").html(Context);
	}


	//JSON加载往期
	function LoadListById(ListID)
	{
			$.getJSON(jsonpurl+ListID, function(json){
				LoadMainList(json);
			});
	}
;